package cuiyt.collection.randomitem.listiterator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;

/**
 * @author cyt
 * @create 2020-10-03 下午 9:50
 */
public class test {
    public static void main(String[] args) {
        Integer[] ints = {1, 2, 3, 4};
        ArrayList<Integer> integers = new ArrayList<Integer>(Arrays.asList(ints));
        Iterator<Integer> iterator = integers.iterator();
        iterator.next();
        iterator.remove();
        while (iterator.hasNext()) {
            System.out.println("while");
            System.out.println("->" + iterator.next());
        }

        integers.forEach(System.out::println);

        for (int i = 0; i < integers.size(); i++) {
            System.out.println(integers.get(i));
        }

    }
}
